/*
   Copyright 2009 Abdulla Abdurakhmanov (abdulla@latestbit.com)
   Original sources are available at www.latestbit.com

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/

package org.latestbit.smartobjects.network;

import org.latestbit.smartobjects.exceptions.InvalidCredentialsException;

/**
 * Server login module provides interface for application side 
 * implementations able and want to authenticate client connections with own users storage
 * @author abdulla-a
 *
 */
public interface IServerLoginModule {

	/**
	 * Checks the specified user login and password
	 * @param manager the handshake manager initiated this request. If application needs information about connection, look to IHandshakeManager.getConnection()
	 * @param login user login 
	 * @param password user password
	 * @return any application side object implemented IUserCredentials or null
	 * @throws InvalidCredentialsException if any error occured (incorrect login/password, user storage unavailable, etc).
	 */
	IUserCredentials authenticate(IHandshakeManager manager, String login, String password)
		throws InvalidCredentialsException;

}
